﻿CREATE PROCEDURE [dbo].[ArticleSales_UpdateFromTempArticleSales]
AS
	UPDATE ArticleSales 
	SET Units = temp.Units,
		Sales = temp.Sales,
		GrossSales = temp.GrossSales,
		GM = temp.GM,
		Price = temp.Price
	FROM TempArticleSales temp, ArticleSales sales 
	WHERE temp.StoreId = sales.StoreId and
		  temp.Date = sales.Date and
		  temp.ArticleId = sales.ArticleId and
		  temp.BonusBuyNumber = sales.BonusBuyNumber
		  and temp.Sales > 0 
		  and temp.Units > 0
		  